package com.cn.ycy.proxy.jdk;


import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * CustomInvocationHandler 这个类做嵌套增强
 */
public class CustomInvocationHandler2 implements InvocationHandler {

  Object student = null;

  public CustomInvocationHandler2(Object student) {
    this.student = student;
  }


  @Override
  public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

    System.out.println("CustomInvocationHandler2：吃饭");
    method.invoke(student, args);
    System.out.println("CustomInvocationHandler2：洗澡");
    return null;
  }
}
